package team.zero.lemon.module.cms.service;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import team.zero.lemon.common.exception.CustomException;
import team.zero.lemon.common.service.CrudService;
import team.zero.lemon.module.cms.dao.IArticleDao;
import team.zero.lemon.module.cms.dao.IAuditDao;
import team.zero.lemon.module.cms.entity.Article;
import team.zero.lemon.module.cms.entity.Audit;

import java.util.List;

/**
 * Created by bolin on 2016/10/25.
 */
@Service
public class AuditService extends CrudService<IAuditDao, Audit> {
    public List<Audit> findByArticleId(int articleId,Integer auditType ) {
        try {
            return dao.findByArticleId(articleId,auditType);
        } catch (Exception e) {
            throw new CustomException(e);
        }
    }
    @Transactional
    public int deleteByArticleId(int articleId) {
        try {
            return dao.deleteByArticleId(articleId);
        } catch (Exception e) {
            throw new CustomException(e);
        }
    }
}
